using System;
using System.Collections;
using System.Web;
using Sedna.Core.Controller;
using Sedna.Core.Controller.Common;

namespace Sedna.Core.Controls.Actions
{
	/// <summary>
	/// Setting ExplodeKitControl default params
	/// </summary>
	public class ExplodeKitOnLoadAction : AbstractAction
	{

		public override IActionResult Execute(IExecutionContext executionContext)
		{
			object isExplodeAllObj = executionContext.GetFromCurrentScope("explodeAllRadioButton.checked");
			object isExplodeLevelObj = executionContext.GetFromCurrentScope("explodeLevelRadioButton.checked");

			if (isExplodeAllObj == null || isExplodeLevelObj == null)
			{
				return new ActionResult(successStatus);
			}

			bool isExplodeAll = (bool) isExplodeAllObj;
			bool isExplodeLevel = (bool) isExplodeLevelObj;

			if (!isExplodeAll && !isExplodeLevel)
			{
				executionContext.SetToCurrentScope("explodeAllRadioButton.checked", true);
			}
			executionContext.SetToCurrentScope("explodeKitCbx.checked", true);

			return CreateResult(successStatus);
		}
	}
}
